package org.restql.webapp.output;

import java.io.PrintWriter;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Document;

public class XmlPrinter {

	public static void printXml(Document doc, PrintWriter printer) throws TransformerException {
		TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer transformer = tFactory.newTransformer ();
        DOMSource source = new DOMSource(doc);
        StreamResult result = new StreamResult(printer);
        transformer.transform (source, result);
	}

}
